Method for adding hardware

ABSTRACT

A method for adding hardware is provided, which is adapted for connecting a plug-and-play device to a computer through a USB port. In the method, an enumeration process is activated. According to the enumeration process, a filter driver identifies a device type of the plug-and-play device. When the device type is an allowable device type, the enumeration process proceeds to add the plug-and-play device onto the computer. When the device type is an excluded device type, a name and a password inputted by the user are received. It is then verified whether the name and the password are correct. When the name and the password are incorrect, the filter driver terminates the enumeration process. When the name and the password are correct, the enumeration process proceeds to add the plug-and-play device onto the computer.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims the priority benefit of Taiwan application serial no. 97133811, filed on Sep. 3, 2008. The entirety of the above-mentioned patent application is hereby incorporated by reference herein and made a part of specification.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention generally relates to a method for controlling peripheral systems, and more particularly, to a method for adding hardware.

2. Description of Related Art

Previously, peripheral devices must be coupled to a computer through various interfaces. For example, a modem and a mouse must be coupled to the computer through a series port, a printer must be coupled to the computer through a parallel port. The I/O interfaces of different specifications can be difficult to manage. In addition, the computer host previously must be shut down before the connection or removal of the peripheral devices, which causes inconvenience in use.

Therefore, the universal serial bus (USB) port standard was developed in the industry, which can support plug-and-play (PNP) function. Peripheral devices can be connected to the computer host for use through the USB port without shutting down or restarting the computer host because of the hot-plugging design of the USB. Currently, many electronic devices, such as, keyboards, scanners, flash drives and digital cameras, have a USB interface.

A user may want to lock the USB port of the computer host for some purposes. However, the hot-plugging function of the USB port is disabled for all device types whether the USB port function is locked by hardware or disabled in the device manager. That is to say, the USB port is locked completely for all types of devices instead of selectively for some device types. As a result, when a particular device needs to be connected to the computer through the USB port, the user must manually activate the function of the USB port, which may cause inconvenience in use.

SUMMARY OF THE INVENTION

Accordingly, the present invention is directed to a method for adding hardware which can increase flexibility in use of the universal serial bus (USB) port.

The present invention is also directed to a method for adding hardware which can selectively disable the USB port for some plug-and-play devices.

The present invention provides a method for adding hardware, which is adapted for at least one USB port of a computer. The computer comprises a plug-and-play manager and a filter driver. In the method, a plug-and-play device is connected to the universal serial bus port. An enumeration process is activated by the plug-and-play manager to produce a query device relation. The query device relation is configured for query of a hierarchy relation of the plug-and-play device in a device tree. A device type of the plug-and-play device is then identified by the filter driver according to the query device relation. When the identified device type is an allowable device type, the method proceeds with the enumeration process to add a device node corresponding to the plug-and-play device into the device tree according to the hierarchy relation. When the identified device type is an excluded device type, a name and a password inputted by a user are received. It is then verified whether the name and the password inputted by the user are correct. The enumeration process is terminated when the name and the password inputted by the user are incorrect. The method proceeds with the enumeration process to add a device node corresponding to the plug-and-play device into the device tree according to the hierarchy relation when the name and the password inputted by the user are correct.

According to one embodiment of the present invention, the method further comprises, before receiving the password inputted by the user, generating a dialog box prompting the user to input the name and the password.

According to one embodiment of the present invention, the method further comprises, after receiving the password inputted by the user, encrypting the password inputted by the user.

According to one embodiment of the present invention, verifying whether the password inputted by the user is correct comprises acquiring an encrypted preset password from a password file and comparing the encrypted preset password with the password inputted by the user.

According to one embodiment of the present invention, the plug-and-play manager maintains the device tree.

According to one embodiment of the present invention, terminating the enumeration process further comprises stopping establishing a physical device object corresponding to the plug-and-play device by a universal serial bus hub driver.

According to one embodiment of the present invention, terminating the enumeration process further comprises stopping searching a device driver corresponding to the plug-and-play device by the plug-and-play manager.

According to one embodiment of the present invention, identifying the device type of the plug-and-play device further comprises classifying the plug-and-play device into an excluded device type and an allowable device type according to a customized condition.

According to one embodiment of the present invention, a user interface displayed on a display of the computer does not show a device removal indication when the enumeration process is being terminated.

The present invention also provides a method for adding hardware, which is adapted for connecting a plug-and-play device to a computer through a USB port. The computer comprises a filter driver. In the method, an enumeration process is activated. A device type of the plug-and-play device is then identified by the filter driver according to the enumeration process. When the identified device type is an allowable device type, the method proceeds with the enumeration process to add the plug-and-play device to the computer. When the identified device type is an excluded device type, a name and a password inputted by a user are received. It is then verified whether the name and the password inputted by the user are correct. The enumeration process is terminated by the filter driver when the name and the password inputted by the user are incorrect. The method proceeds with the enumeration process to add the plug-and-play device to the computer when the name and the password inputted by the user are correct.

According to one embodiment of the present invention, the method further comprises, before receiving the password inputted by the user, generating a dialog box prompting the user to input the name and the password.

According to one embodiment of the present invention, the method further comprises, after receiving the password inputted by the user, encrypting the password inputted by the user.

According to one embodiment of the present invention, verifying whether the password inputted by the user is correct comprises acquiring an encrypted preset password from a password file and comparing the encrypted preset password with the password inputted by the user.

According to one embodiment of the present invention, terminating the enumeration process further comprises stopping establishing a physical device object corresponding to the plug-and-play device by a universal serial bus hub driver.

According to one embodiment of the present invention, terminating the enumeration process further comprises stopping searching a device driver corresponding to the plug-and-play device.

According to one embodiment of the present invention, identifying the device type of the plug-and-play device further comprises classifying the plug-and-play device into an excluded device type and an allowable device type according to a customized condition.

According to one embodiment of the present invention, a user interface displayed on a display of the computer does not show a device removal indication when the enumeration process is being terminated.

According to the embodiment of the present invention, when a plug-and-play device is physically connected to the USB port of the computer, an enumeration process is activated by the plug-and-play manager, and the filter driver identifies whether the plug-and-play device is of an allowable device type. When the plug-and-play device is identified to be of an excluded device type by the filter driver, the user is prompted to input the name and the password. When the name and the password inputted by the user are incorrect, the filter driver terminates the enumeration process. Therefore, the user perceives no device removal information on the computer display. When it is determined that the name and the password inputted by the user are correct, the enumeration process proceeds and the plug-and-play device identified to be of the excluded device type is added onto the computer for user's use.

In addition, at the beginning of the enumeration process, a software module may be used to determine whether a device is allowed to be added, to selectively allow addition of some types of devices. As to the devices of the excluded device type, the computer host can determine whether to lock the USB port according to the name and the password inputted by the user. Therefore, the USB port of the computer host can be selectively locked for some devices to increase the flexibility in use of the USB port and prevent an unknown user from using an accessible plug-and-play device to steal data from the computer.

In order to make the aforementioned and other features and advantages of the present invention more comprehensible, embodiments accompanied with figures are described in detail below.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a flow chart of a method for adding hardware according to one embodiment of the present invention.

DESCRIPTION OF THE EMBODIMENTS

FIG. 1 is a flow chart of a method for adding hardware according to one embodiment of the present invention. Referring to FIG. 1, a computer 200 includes at least one universal serial bus (USB) port 202, a plug-and-play manager, a filter driver, and a USB hub driver. The plug-and-play manager maintains a device tree that enables the computer system to keep track of effectively used devices and information of the devices in the computer system. In addition, the filter driver is, for example, an upper-level filter driver. Initially, in step S101, a plug-and-play device 204 is connected to the USB port 202. The plug-and-play device 204 is, for example, a computer peripheral device complying with the USB interface specification, such as, a mouse, a keyboard, a touch pad, a display, a portable storage media, or the like.

In step S103, when the plug-and-play device 204 is connected to the computer 200, an enumeration process is activated by the plug-and-play manager of the computer 200. A query device relation is produced by the enumeration process. The query device relation is used for query of a hierarchy relation of the plug-and-play device 204 in the device tree maintained by the plug-and-play manager.

In step S105, the filter driver of the computer identifies a device type of the plug-and-play device 204 according to the query device relation. The step of identifying the device type of the plug-and-play device 204 also includes classifying the plug-and-play device 204 into an excluded device type and an allowable device type according to a customized condition. That is, the user may determine the types of devices allowable to be added to the USB port (i.e., allowable device types), such as, human interface devices (HID) including the mouse, touch pad, pen mouse, keyboard, or the like, and the types of devices refused to be added to the USB port (i.e., excluded device types), such as, the portable storage media.

Therefore, when the plug-and-play device 204 is of an allowable device type, the enumeration process proceeds (step S107). Specifically, a device node corresponding to the plug-and-play device 204 is added into the device tree according to the hierarchy relation of the plug-and-play device 204 in the device tree, the USB hub driver establishes a physical device object corresponding to the plug-and-play device 204, and the plug-and-play manager searches the driver of the plug-and-play device 204, thus completing the addition of the plug-and-play device 204 onto the computer 200. As such, the device information of the plug-and-play device 204 newly added onto the computer 200 can be found in a device manager of the computer system.

On the other hand, when the plug-and-play device 204 is of an excluded device type, a name and a password inputted by the user are received (step S109). In addition, before step S109 is performed, the computer system generates a dialog box prompting the user to input the name and the password. Besides, in the present embodiment, upon receiving the password inputted by the user, the computer system encrypts the password in a non-recoverable manner, i.e., the password cannot be recovered after being encrypted, which can ensure a secure use of the plug-and-play device.

Then, when the computer receives the name and the password inputted by the user, it is verified whether the name and the password inputted by the user are correct in step S111. In step S111, the computer first acquires an encrypted preset password from a password file, and then, the encrypted preset password is compared with the password inputted by the user using the filter driver to verify whether the name and the password inputted by the user are correct.

Next, when the name and the password inputted by the user are incorrect, the method proceeds to step S113 to terminate the enumeration process. Specifically, the USB hub driver stops establishing the physical device object corresponding to the plug-and-play device 204, and the plug-and-play manager stops searching the device driver corresponding to the plug-and-play device 204. Because the USB hub driver stops establishing the physical device object corresponding to the plug-and-play device 204 when the enumeration process is terminated, the user interface displayed on the display 200 a of the computer will not show a device removal indication.

On the contrary, when the name and the password inputted by the user are correct (i.e., the user becomes ID verified), the enumeration process proceeds. Specifically, a device node corresponding to the plug-and-play device 204 is added into the device tree according to the hierarchy relation of the plug-and-play device 204 in the device tree, the USB hub driver establishes a physical device object corresponding to the plug-and-play device 204, and the plug-and-play manager searches the driver of the plug-and-play device 204, thus completing the addition of the plug-and-play device 204 onto the computer 200. Also, the device information of the plug-and-play device 204 newly added onto the computer 200 can be found in the device manager of the computer system. As such, the present embodiment indeed can effectively manage the use of the plug-and-play devices. Even if the plug-and-play device is identified to be of an excluded device type, the plug-and-play device can still be used as long as the user inputs the correct name and password, thereby facilitating the use of the plug-and-play device and preventing data in the computer from being stolen.

In summary, according to the embodiment of the present invention, when a plug-and-play device is physically connected to the USB port of the computer, an enumeration process is activated by the plug-and-play manager, and the filter driver identifies whether the plug-and-play device is of an allowable device type. When the plug-and-play device is identified to be of an excluded device type by the filter driver, the user is prompted to input a name and a password. When the name and the password inputted by the user are incorrect, the filter driver terminates the enumeration process. Therefore, the user will perceive no device removal information on the computer display. When it is determined that the name and the password inputted by the user are correct, the enumeration process proceeds and the plug-and-play device identified to be of an excluded device type is added onto the computer for user's use.

In addition, at the beginning of the enumeration process, a software module may be used to determine whether a device is allowed to be added, to selectively allow addition of some types of devices. As to the devices of the excluded device type, the computer host can determine whether to lock the USB port according to the name and the password inputted by the user. Therefore, the USB port of the computer host can be selectively locked for some devices to increase the flexibility in use of the USB port and prevent an unknown user from using an accessible plug-and-play device to steal data from the computer.

It will be apparent to those skilled in the art that various modifications and variations can be made to the structure of the present invention without departing from the scope or spirit of the invention. In view of the foregoing, it is intended that the present invention cover modifications and variations of this invention provided they fall within the scope of the following claims and their equivalents. 

1. A method for adding hardware, which is adapted for at least one universal serial bus port of a computer, the computer comprising a plug-and-play manager and a filter driver, the method comprising: connecting a plug-and-play device to the universal serial bus port; activating an enumeration process by the plug-and-play manager to produce a query device relation, the query device relation being configured for query of a hierarchy relation of the plug-and-play device in a device tree; and identifying a device type of the plug-and-play device by the filter driver according to the query device relation, wherein, when the identified device type is an allowable device type, the enumeration process proceeds to add a device node corresponding to the plug-and-play device into the device tree according to the hierarchy relation; when the identified device type is an excluded device type, a name and a password inputted by a user are received; it is verified whether the inputted name and the inputted password are correct; the enumeration process is terminated when the inputted name and the inputted password are incorrect; and the enumeration process proceeds to add a device node corresponding to the plug-and-play device into the device tree according to the hierarchy relation when the inputted name and the inputted password are correct.
 2. The method for adding hardware according to claim 1, further comprising, before receiving the password inputted by the user, generating a dialog box for the user to input the name and the password.
 3. The method for adding hardware according to claim 1, further comprising, after receiving the inputted password, encrypting the inputted password.
 4. The method for adding hardware according to claim 3, wherein verifying whether the inputted password is correct comprises: acquiring an encrypted preset password from a password file; and comparing the encrypted preset password with the inputted password.
 5. The method for adding hardware according to claim 1, wherein the plug-and-play manager maintains the device tree.
 6. The method for adding hardware according to claim 1, wherein terminating the enumeration process further comprises stopping establishing a physical device object corresponding to the plug-and-play device by a universal serial bus hub driver.
 7. The method for adding hardware according to claim 1, wherein terminating the enumeration process further comprises stopping searching a device driver corresponding to the plug-and-play device by the plug-and-play manager.
 8. The method for adding hardware according to claim 1, wherein identifying the device type of the plug-and-play device further comprises classifying the plug-and-play device into an excluded device type and an allowable device type according to a customized condition.
 9. The method for adding hardware according to claim 1, wherein a user interface displayed on a display of the computer does not show a device removal indication when the enumeration process is being terminated.
 10. A method for adding hardware which is adapted for connecting a plug-and-play device to a computer through a universal serial bus port, the computer comprising a filter driver, the method comprising: activating an enumeration process; and identifying a device type of the plug-and-play device by the filter driver according to the enumeration process, wherein, when the identified device type is an allowable device type, the enumeration process proceeds to add the plug-and-play device to the computer; when the identified device type is an excluded device type, a name and a password inputted by a user are received; it is verified whether the inputted name and the inputted password are correct; the enumeration process is terminated by the filter driver when the inputted name and the inputted password are incorrect; and the enumeration process proceeds to add the plug-and-play device to the computer when the inputted name and the inputted password are correct.
 11. The method for adding hardware according to claim 10, further comprising, before receiving the password inputted by the user, generating a dialog box for the user to input the name and the password.
 12. The method for adding hardware according to claim 10, further comprising, after receiving the inputted password, encrypting the inputted password.
 13. The method for adding hardware according to claim 12, wherein verifying whether the inputted password is correct comprises: acquiring an encrypted preset password from a password file; and comparing the encrypted preset password with the inputted password.
 14. The method for adding hardware according to claim 10, wherein terminating the enumeration process further comprises stopping establishing a physical device object corresponding to the plug-and-play device by a universal serial bus hub driver.
 15. The method for adding hardware according to claim 10, wherein terminating the enumeration process further comprises stopping searching a device driver corresponding to the plug-and-play device.
 16. The method for adding hardware according to claim 10, wherein identifying the device type of the plug-and-play device further comprises classifying the plug-and-play device into an excluded device type and an allowable device type according to a customized condition.
 17. The method for adding hardware according to claim 10, wherein a user interface displayed on a display of the computer does not show a device removal indication when the enumeration process is being terminated. 